package core {
	/**
	 * ...
	 * @author Zszen
	 */
	public class CoordinatesCal {
		private static const EARTH_RADIUS:Number = 6378.137;
		private static function rad(d:Number):Number{
			return d * Math.PI / 180.0;
		}
		public static function GetDistance(lat1:Number, lng1:Number, lat2:Number, lng2:Number):Number{
			var radLat1:Number = rad(lat1);
			var radLat2:Number = rad(lat2);
			var a:Number = radLat1 - radLat2;
			var b:Number = rad(lng1) - rad(lng2);
			var s:Number = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a/2),2) + 
			 Math.cos(radLat1)*Math.cos(radLat2)*Math.pow(Math.sin(b/2),2)));
			s = s * EARTH_RADIUS;
			s = Math.round(s * 10000) / 10000;
			return s;
		}
	}

}